//
// Copyright (C) 2011 - 2013  Steve Channell steve.channell@cepheis.com
//
// This file is part of Cephei.QL, an open-source library wrapper 
// arround QuantLib http://quantlib.org/
//
// Cephei.QL is open source software: you can redistribute it and/or modify it
// under the terms of the license.  You should have received a
// copy of the license along with this program; if not, please email
// <support@cepheis.com>. The license is also available online at
// <http://cepheis.com/license.htm>.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE.  See the license for more details.
//
// Version 2.2 with QuantLib 1.2.1
//#include "stdafx.h"
#include "MonotonicLogParabolic.h"
using namespace Cephei::QL::Math::Interpolations;
#include <gen/QL/Math/Interpolations/LogCubicInterpolation.h>
#undef HANDLE
#undef ABSTRACT
#undef STRUCT
Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::CMonotonicLogParabolic (boost::shared_ptr<QuantLib::MonotonicLogParabolic>& childNative, Object^ owner) : CLogCubicInterpolation(CMonotonicLogParabolic::typeid)
{
#ifdef HANDLE
	_phMonotonicLogParabolic = NULL;
#endif
	_ppMonotonicLogParabolic = &childNative;
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppMonotonicLogParabolic));
}
Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::CMonotonicLogParabolic (QuantLib::MonotonicLogParabolic& childNative, Object^ owner) : CLogCubicInterpolation(CMonotonicLogParabolic::typeid)
{
#ifdef HANDLE
	_phMonotonicLogParabolic = NULL;
#endif
	_ppMonotonicLogParabolic = new boost::shared_ptr<QuantLib::MonotonicLogParabolic> (&childNative);
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppMonotonicLogParabolic));
    _MonotonicLogParabolicOwner = owner;
    _LogCubicInterpolationOwner = owner;
}

Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::CMonotonicLogParabolic (CMonotonicLogParabolic^ copy) : CLogCubicInterpolation(CMonotonicLogParabolic::typeid)
{
#ifdef HANDLE
	_phMonotonicLogParabolic = NULL;
#endif
	if (copy->HasNative() != NULL)
    {
		_ppMonotonicLogParabolic = new boost::shared_ptr<QuantLib::MonotonicLogParabolic> (copy->GetShared());
        _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppMonotonicLogParabolic));
    }
}
Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::CMonotonicLogParabolic (PLATFORM::Type^ t) : CLogCubicInterpolation(CMonotonicLogParabolic::typeid)
{
#ifdef HANDLE
	_phMonotonicLogParabolic = NULL;
#endif
	if (!t->IsSubclassOf(CMonotonicLogParabolic::typeid))
		throw REFNEW Exception ("Invalid base-case init");
}
#ifdef HANDLE
Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::CMonotonicLogParabolic (QuantLib::Handle<QuantLib::MonotonicLogParabolic>& childNative, Object^ owner)  : CLogCubicInterpolation(CMonotonicLogParabolic::typeid)
{
	_phMonotonicLogParabolic = &childNative;
	_ppMonotonicLogParabolic = &static_cast<boost::shared_ptr<QuantLib::MonotonicLogParabolic>>(childNative.currentLink());
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppMonotonicLogParabolic));
    _MonotonicLogParabolicOwner = owner;
}
Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::CMonotonicLogParabolic (QuantLib::Handle<QuantLib::MonotonicLogParabolic> childNative)  : CLogCubicInterpolation(CMonotonicLogParabolic::typeid)
{
	_phMonotonicLogParabolic = &childNative;
	_ppMonotonicLogParabolic = &static_cast<boost::shared_ptr<QuantLib::MonotonicLogParabolic>>(childNative.currentLink());
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppMonotonicLogParabolic));
}
#endif
#ifdef STRUCT
Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::CMonotonicLogParabolic (QuantLib::MonotonicLogParabolic childNative)  : CLogCubicInterpolation(CMonotonicLogParabolic::typeid)
{
#ifdef HANDLE
	_phMonotonicLogParabolic = NULL;
#endif
	_ppMonotonicLogParabolic = new boost::shared_ptr<QuantLib::MonotonicLogParabolic> (new QuantLib::MonotonicLogParabolic (childNative));
    _ppLogCubicInterpolation = new boost::shared_ptr<QuantLib::LogCubicInterpolation> (boost::dynamic_pointer_cast<QuantLib::LogCubicInterpolation> (*_ppMonotonicLogParabolic));
}
#endif

Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::~CMonotonicLogParabolic ()
{
    if (_ppMonotonicLogParabolic != NULL)
    {
	    delete _ppMonotonicLogParabolic;
        _ppMonotonicLogParabolic = NULL;
    }
}
Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::!CMonotonicLogParabolic ()
{
    if (_ppMonotonicLogParabolic != NULL)
    {
	    delete _ppMonotonicLogParabolic;
    }
}
QuantLib::MonotonicLogParabolic& Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::GetReference ()
{
    if (_ppMonotonicLogParabolic == NULL) throw REFNEW NativeNullException ();
	return **_ppMonotonicLogParabolic;
}
boost::shared_ptr<QuantLib::MonotonicLogParabolic>& Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::GetShared ()
{
    if (_ppMonotonicLogParabolic == NULL) throw REFNEW NativeNullException ();
	return *_ppMonotonicLogParabolic;
}
QuantLib::MonotonicLogParabolic* Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::GetPointer ()
{
    if (_ppMonotonicLogParabolic == NULL) throw REFNEW NativeNullException ();
	return &**_ppMonotonicLogParabolic;
}
#ifdef HANDLE
QuantLib::Handle<QuantLib::MonotonicLogParabolic>& Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::GetHandle ()
{
	if (_phMonotonicLogParabolic == NULL)
	{
		_phMonotonicLogParabolic = new Handle<QuantLib::MonotonicLogParabolic> (*_ppMonotonicLogParabolic);
	}
	return *_phMonotonicLogParabolic;
}
#endif
bool Cephei::QL::Math::Interpolations::CMonotonicLogParabolic::HasNative () 
{
	return (_ppMonotonicLogParabolic != NULL);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Factory class

